package com.csweimei.rentmanagementtreasure.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.csweimei.rentmanagementtreasure.R;

public class HouseCxAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    public HouseCxAdapter() {
        super(R.layout.item_quarter);
    }
    private int flag = -1;
    public void setSel(int index){
        flag = index;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, String s) {
        baseViewHolder.setText(R.id.name,s);


        if (getItemPosition(s) == flag){
            baseViewHolder.setTextColorRes(R.id.name,R.color.main_c);
            baseViewHolder.setBackgroundResource(R.id.name,R.drawable.rect_f6_60_s);
        }else {
            baseViewHolder.setTextColorRes(R.id.name,R.color.text_9d);
            baseViewHolder.setBackgroundResource(R.id.name,R.drawable.rect_f6_60);
        }
    }
}
